<?php

namespace app\admin\model;

use think\Db;
use think\Model;

class ClassificationModel extends Model
{

    // 设置数据表（不含前缀）
    protected $name = 'classification';
    // 设置当前模型对应的完整数据表名称
    protected $table = 'ld_classification';

    public function __construct($data = [])
    {
        parent::__construct($data);
    }


    /**
     * @param $where
     * @param $page
     * @param $limit
     * @param 问题分类列表
     */
    public function userlist($where,$page,$limit){
        $query = Db::name($this->name)->where($where)->order('addTime desc')->page($page)->limit($limit)->select();
        return $query;
    }

    public function county($where){
        $query = Db::name($this->name)->where($where)->count();
        return $query;
    }


    /**
     * @param $data
     * @param 添加分类
     */
    public function addlist($data){
        $query = Db::name($this->name)->insert($data);
        return $query;
    }


    /**
     * @param $where
     * @param $data
     * @param 修改分类
     */
    public function editlist($where,$data){
        $query = Db::name($this->name)->where($where)->update($data);
        return $query;
    }


    /**
     * @param $where
     * @param 删除分类
     */
    public function dellist($where){
        $query = Db::name($this->name)->where($where)->delete();
        return $query;
    }


    /**
     * @param 获取负责类型
     */
    public function datalist($where){
        $query = Db::name($this->name)->where($where)->field('id,titlename,curl,steate')->select();
        return $query;
    }

    /**
     * @param 获取负责类型
     */
    public function datalistd(){
        $query = Db::name($this->name)->field('id,titlename')->select();
        return $query;
    }


    /**
     * @param $where
     * @param $data
     * @param 开起关闭域名显示
     */
    public function shows($where,$data){
        $query = Db::name($this->name)->where($where)->update($data);
        return $query;
    }


}